package service

import "yun_image/dao"

// CheckApiAccess 验证某个角色是否有权限访问某个api接口
func CheckApiAccess(result *bool, apiPath string, roleId int) error {
	var paths []string
	err := dao.GetApiPathsByRoleId(&paths, roleId)
	if err != nil {
		return err
	}
	for _, value := range paths {
		if apiPath == value {
			*result = true
			return nil
		}
	}
	*result = false
	return nil
}
